package main

import "fmt"

type Count struct {
	num int
}

func (c Count) add() int {
	c.num++
	return c.num
}

func (c *Count) increase() int {
	c.num++
	return c.num
}

func main() {
	v1 := Count{100}
	v2 := Count{100}
	p1 := &Count{100}
	p2 := &Count{100}
	for i := 0; i < 3; i++ { // type he1 *type是两个不同的类型，但两者操作是兼容的
		fmt.Printf("v1.add=%d, v2.increase=%d, p1.add=%d, p2.increase=%d\n", v1.add(), v2.increase(), p1.add(), p2.increase())
	}
}
